package cn.com.bluemoon.daps.sync.core.sync.compare;

import cn.com.bluemoon.daps.common.toolkit.BmAssetUtils;
import cn.com.bluemoon.daps.model.entity.DapDataModelTable;
import cn.com.bluemoon.daps.sync.core.sync.GlobalConfig;
import cn.com.bluemoon.daps.sync.core.sync.Tuple2;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * 表数据对比
 * 利用bmSql进行生成sql后采集返回
 *
 * @author Jarod.Kong
 * @date 2021/1/14 9:38
 */
@Slf4j
public abstract class TableComparator<R> extends BaseComparator<DapDataModelTable, R> {

    public TableComparator(GlobalConfig globalConfig, Tuple2<DapDataModelTable> tableTuple2) {
        super(globalConfig, tableTuple2);
    }

    @Override
    public void change0(List<R> sqlCollector) {
        BmAssetUtils.notNull(oldTable, "表语句-表信息不可为空");
        BmAssetUtils.notNull(newTable, "表语句-表信息不可为空");
    }

    @Override
    public void drop0(List<R> sqlCollector) {
        BmAssetUtils.notNull(oldTable, "删除表语句-表信息不可为空");
    }

    @Override
    public void create0(List<R> sqlCollector) {
        BmAssetUtils.notNull(newTable, "创建表语句-表信息不可为空");
    }
}
